﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Quartz.Api.Attr;
using System;
using static Quartz.Api.GlobalVar.CustomApiVersion;

namespace Quartz.Api.Controllers
{
    [ApiController]
    [CustomRoute(ApiVersions.V1)]
    public class HealthController : Controller
    {
        /// <summary>
        /// 启用服务定时调用此接口让站点一直保持运行
        /// </summary>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpGet]
        public IActionResult KeepAlive()
        {
            return Json(new { status = true });
        }

        /// <summary>
        /// 返回当前时间
        /// </summary>
        /// <returns></returns>
        ///  [AllowAnonymous]
        [HttpGet]
        public IActionResult Time()
        {
            return Json(new { status = true, msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
        }
    }
}